import pprint
from datetime import datetime

from pymongo import MongoClient

client = MongoClient("mongodb://192.168.6.180:27017/")
col = client['kexie']['institution']


inserted = col.insert_one({"institution_name": "机关部门", "level": 0, "in_kexie": True, "parent_institution_name": "root",
                           "update_time": datetime.utcnow(), "create_time": datetime.utcnow()})

bulk = ["办公厅",
"组织人事部",
"宣传文化部",
"科学技术创新部",
"科学技术普及部",
"战略发展部",
"国际合作部",
"机关党委(学会党建办公室)",
"机关离退办"]

data = [{"institution_name": item, "level": 1, "in_kexie": True, "parent_institution_name": "机关部门",  "update_time": datetime.utcnow(), "create_time": datetime.utcnow()} for item in bulk]

col.insert_many(data)


inserted = col.insert_one({"institution_name": "直属单位", "level": 0, "in_kexie": True, "parent_institution_name": "root",
                           "update_time": datetime.utcnow(), "create_time": datetime.utcnow()})


bulk = ["创新战略研究院",
"中国科普研究所",
"学会服务中心",
"信息中心",
"中国科技馆",
"青少年科技中心",
"企业创新服务中心",
"农村专业技术服务中心",
"中国国际科技交流中心",
"科学技术传播中心",
"培训和人才服务中心",
"科技导报社",
"机关服务中心",
"中国科技会堂",
"新技术开发中心",
"中国科学技术出版社"]

data = [{"institution_name": item, "level": 1, "in_kexie": True, "parent_institution_name": "直属单位",  "update_time": datetime.utcnow(), "create_time": datetime.utcnow()} for item in bulk]
#
col.insert_many(data)
